﻿// JScript File

function SendIRCMessage(){
    var message = "(" + document.getElementById("playerName").value + ") " + document.getElementById("playerText").value;
    plzHalp.GameService.SendIRCMessage(message, SentIRCMessage, sendError);
}

function SentIRCMessage(){
        document.getElementById("playerText").value = "";
        document.getElementsByTagName("BODY")[0].focus();
}

function GetIRCText()
{
    plzHalp.GameService.GetIRCText(GotIRCText, FailedEntities);
}

function GotIRCText(result)
{
    var readLines = new Array();
    var output;
    
    // Page element to display feedback.
    var RsltElem = document.getElementById("ResultId");
    
    var readResult;
    for (i=0;i<result.length;i++){
           readLines[i] = result[i] + "<BR>" //result.documentElement.childNodes[i].attributes[0].nodeValue + "<BR>";
    }
	
    // Check if we've got a displayed array yet
    var ChatDiv = document.getElementById('ChatBoard');
    var cLine = 9;
	for (i = readLines.length; i >= 0 && cLine >= 0; i--){
        if(readLines[i]!=null){
            ChatDiv.childNodes[cLine].innerHTML=readLines[i];
            cLine--;
        }
    }
	
}